package stiletto.user.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import stiletto.user.dao.UserDao;
import stiletto.user.domain.User;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: 82022170
 * Date: 13. 10. 28
 * Time: 오후 4:02
 * To change this template use File | Settings | File Templates.
 */
public interface UserService {
  public void setUserDao(UserDao userDao);
  /**
   *
   * @param newUser
   * @throws DuplicatedUserException
   */
  @Transactional(propagation = Propagation.REQUIRED)
  public void addUser(User newUser) throws DuplicatedUserException;

  /**
   *
   * @param user
   * @throws UserNotFoundException 수정할 사용자가 없을 경우 발생
   */
  @Transactional(propagation = Propagation.REQUIRED)
  public void updateUser(User user) throws UserNotFoundException;

  /**
   *
   * @param email
   * @throws UserNotFoundException
   */
  @Transactional(propagation = Propagation.REQUIRED)
  public void deactivateUser(String email) throws UserNotFoundException;

  /**
   *
   * @param email
   * @throws UserNotFoundException
   */
  @Transactional(propagation = Propagation.REQUIRED)
  public void activateUser(String email) throws UserNotFoundException;

  /**
   *
   * @param email
   * @return
   * @throws UserNotFoundException
   */
  @Transactional(readOnly = true)
  public User findOneUser(String email) throws UserNotFoundException;

  /**
   *
   * @return
   * @throws UserNotFoundException
   */
  @Transactional(readOnly = true)
  public List<User> findAllUsers() throws UserNotFoundException;

  /**
   *
   * @param screenName
   * @return
   * @throws UserNotFoundException 해당하는 screen name이 없을 경우 발생
   */
  @Transactional(readOnly = true)
  public List<User> findUsersByScreenName(String screenName) throws UserNotFoundException;
}
